import {Layer} from "./layer";
import {Object} from "./object";

export class Button extends Object {
    constructor(canvas, ctx, x, y) {
        super(ctx, x, y);
        this.canvas = canvas;
        this.ctx = ctx;
        this.width = 0;
        this.height = 0;
        this.x = canvas.width - 180 - 15;
        this.y = 15;
        window.addEventListener("huangbiao", function (e) {
            console.log("aaa")
        }, false)
    }

    draw(index) {
        this.ctx.beginPath();
        this.ctx.rect(this.x, this.y, 180, 30);
        this.ctx.fillStyle = "#007bff";
        this.ctx.fill();
        this.ctx.lineWidth = 1;
        this.ctx.strokeStyle = "#0056b3";
        this.ctx.stroke();
        this.ctx.fillStyle = "#ffffff";
        this.ctx.textAlign = "center";
        this.ctx.textBaseline = "middle";
        this.ctx.fillText("buttonText", this.x + 180 / 2, this.y + 30 / 2);
        this.ctx.closePath();
    }
}
